package com.iman.Confucius.service.impl.student;

import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import com.iman.Confucius.domain.MessageDetailBean;
import com.iman.Confucius.domain.User;
import com.iman.Confucius.service.MongoMessageDetailService;
import com.iman.Confucius.service.student.CaseService;
import com.iman.Confucius.service.student.ClassService;
import com.iman.Confucius.vo.CaseVo;
import com.iman.Confucius.vo.student.ClassVo;
import com.iman.common.hibernate.TemplateQLService;
import com.iman.common.support.Page;

@Service
public class ClassServiceImpl implements ClassService{

	@Inject
	TemplateQLService templateQLService;
 
	/**
	 * 获取某班级的所有老师
	 * @param params: classes_id=:classid
	 * @return
	 */
	@Override
	public List<User> getClassTeacher(Map<String, Object> params) {
 		List<User> classes = templateQLService.findBySQLBeanQuery("class-classteacher-list", params, User.class);
		return classes;
	}

	
	/**
	 * 获取某学员的所有班级
	 */
	@Override
	public List<ClassVo> getStudentClass(Map<String, Object> params) {
 		List<ClassVo> classes = templateQLService.findBySQLBeanQuery("class-studentclass-list", params, ClassVo.class);
		return classes;
	}

	@Override
	public List<User> getStudents(Map<String, Object> params) {
		List<User> users = templateQLService.findBySQLBeanQuery("class-classstudents-list", params, User.class);
		return users;
	}
	
	@Override
	public Page<User> getStudentsPage(Map<String, Object> params) {
		Integer ps =  Integer.valueOf(params.get("ps").toString());
		Integer pn =Integer.valueOf(params.get("pn").toString());
		Page<User> users = templateQLService.findByPagedSQLBeanQuery("class-classstudents-page", params, 
				Page.getStartOfPage(pn, ps), ps,User.class);
		return users;
	}
	 
	
 
	
 	
}
